package com.jboost.modules.app.controller;

import com.alibaba.fastjson.JSONObject;
import com.jboost.common.api.vo.Result;
import com.jboost.modules.app.constant.BaseResult;
import com.jboost.modules.app.dto.resp.InvoiceInfo;
import com.jboost.modules.app.service.ChatGptService;
import com.jboost.modules.app.util.StrategyFactory;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Api(tags = "客户管理")
@RestController
@RequestMapping("/xiaoman")
@Slf4j
@AllArgsConstructor
public class GptController {



    ChatGptService chatGptService;

    @GetMapping(value = "/gpt")
    @ApiOperation(value = "数据推送", notes = "数据推送")
    public Result<String> push(@RequestParam(name = "msg") String msg) throws Exception {
        return Result.OK(chatGptService.requsetGpt(msg));
    }


    @GetMapping(value = "/url", produces = "application/json;charset=UTF-8")
    @ApiOperation(value = "发票转换", notes = "发票转换")
    public Result<InvoiceInfo> invoice(@RequestParam(name = "url") String url) throws Exception {
        return Result.OK(chatGptService.requsetInvoice(url));
    }



}
